package ren.kane.phoenix.thread;

/**
 * @author renrk(1275) on 2019-08-15 2:58 PM
 **/
public class PriorityTest {
    public static void main(String[] args) {
        System.out.println(Thread.currentThread().getName() + "(" + Thread.currentThread().getPriority() + ")");
        Thread t1 = new ThreadF("t1");
        Thread t2 = new ThreadF("t2");
        t1.setPriority(10);
        t2.setPriority(1);
        t1.start();
        t2.start();
    }
}

class ThreadF extends Thread {
    public ThreadF(String name) {
        super(name);
    }

    @Override
    public void run() {
        for (int i = 0; i < 5; i++) {
            System.out.println(Thread.currentThread().getName() + "(" + Thread.currentThread().getPriority() + ")" + ", loop " + i);
        }
    }
}